<#assign contextPath=springMacroRequestContext.getContextPath() />
<#import "/public/frame/main.html" as frame />
<@frame.head "南航明珠商城-畅销商品管理">
</@frame.head>
<link rel="stylesheet" type="text/css" href="${contextPath}/resources/css/search_table.css" />
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 后台管理中心 <span class="c-gray en">&gt;</span> 商品管理 <span class="c-gray en">&gt;</span> 商品问答管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
   <div class="text-c">
    <form action="${contextPath}/productQuestions/query_list" method="post" name="search_form" id="search_form">
       <input type="hidden" name="page" value="${pagination.pageNo}"  id="page" />  
       <table class="table search_table" >
										<tr>
											<td class="form_label">

												<label for="">
													会员卡号：
												</label>
											</td>
											<td>
												<input id="memberNo" class="input-text  radius"
													name="memberNo" type="text" maxlength="21"
													value="${productQuestionsQo.memberNo}" 
													onkeyup='this.value=this.value.replace(/\D/g,"")'/>

											</td>
											<td class="form_label">

												<label for="">
													商品编号：
												</label>
											</td>
											<td>
												<input id="ordernno" class="input-text  radius"
													name="productNo" type="text" maxlength="21"
													value="${productQuestionsQo.productNo}" 
													onkeyup='this.value=this.value.replace(/\D/g,"")'/>

											</td>

											 <td class="form_label">
												<label for="">
													商品名称：
												</label>
											</td>
											<td>
												<input id="prodname" class="input-text  radius"
													name="productName" type="text"
													value="${productQuestionsQo.productName}" />
											</td>
											<tr>
											<td class="form_label">
												<label for="">
													咨询时间：
												</label>
											</td>
											<td>
		
												<input  type="text" onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'askDateEnd\')}',readOnly: true })" id="askDateStart" 
									               value='${(productQuestionsQo.askDateStart?string("yyyy-MM-dd"))!}' name="askDateStart"  class="input-text Wdate" style="width:45%;">
									                                                至
									               <input  type="text" onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'askDateStart\')}',readOnly: true })" id="askDateEnd" 
									               value='${(productQuestionsQo.askDateEnd?string("yyyy-MM-dd"))!}' name="askDateEnd"    class="input-text Wdate" style="width:45%;">

											</td>
											<td class="form_label">

												<label for="">
													咨询类型：
												</label>
											</td>
											<td width="300px">
											<span class="select-box radius">
											<input id="changeTypesHidden" type="hidden" value="${productQuestionsQo.type}"/> <!-- 存储查询刷新页面之后，咨询类型的值 -->
											<select onchange="changeType()" id="changeTypes" name="type" class="select">
										<option  value="">全部</option>
                                        <option   value="1">实物商品
                                        </option>
                                        <option value="2">虚拟商品
                                        </option>
                                        <option value="3">机票优惠券
                                        </option>
                                        <option value="4">其他-购票资质
                                        </option>
                                        <option value="5">其他-升舱资质
                                        </option>
											</select>
											</span>
											</td>
											<td colspan="2">
											<span class="select-box radius">
											<input id="classifiedConsultationIdHidden" type="hidden" value="${productQuestionsQo.classifiedConsultationId}"/><!-- 存储查询刷新页面之后，咨询类型二级目录的值 -->
											<select name="classifiedConsultationId" id="classifiedConsultationId" class="select">
											<option  value="">全部
                                        	</option>
											</select>
											</span>
											</td>
											</tr>
											<tr>
											<td class="form_label">

												<label for="">
													回复状态：
												</label>
											</td>
											<td>
											<span class="select-box radius">
											<select  id="answerStatus" name="answerStatus" class="select">
										<option  value="">全部
                                        </option>
                                        <option <#if productQuestionsQo.answerStatus==1> selected="selected" </#if>  value="1">未回复
                                        </option>
                                        <option <#if productQuestionsQo.answerStatus==2> selected="selected" </#if> value="2"  >已回复
                                        </option>
                                        <option <#if productQuestionsQo.answerStatus==3> selected="selected" </#if> value="3"  >无需回复，已处理
                                        </option>
											</select>
											</span>

											</td>
										<td class="form_label">

												<label for="">
													审核状态：
												</label>
											</td>
											<td>
											<span class="select-box radius">
											<select  id="examineStatus" name="examineStatus" class="select">
										<option  value="">全部
                                        </option>
                                        <option <#if productQuestionsQo.examineStatus==1> selected="selected" </#if>  value="1">未审核
                                        </option>
                                        <option <#if productQuestionsQo.examineStatus==2> selected="selected" </#if> value="2"  >审核通过
                                        </option>
                                        <option <#if productQuestionsQo.examineStatus==3> selected="selected" </#if> value="3"  >审核驳回
                                        </option>
											</select>
											</span>
											</td>
										<td class="form_label">

												<label for="">
													显示状态：
												</label>
											</td>
											<td>
											<span class="select-box radius">
											<select  id="showStatus" name="showStatus" class="select">
										<option  value="">全部
                                        </option>
                                        <option <#if productQuestionsQo.showStatus==1> selected="selected" </#if>  value="1">已显示
                                        </option>
                                        <option <#if productQuestionsQo.showStatus==2> selected="selected" </#if> value="2"  >已隐藏
                                        </option>
                                        <option <#if productQuestionsQo.showStatus==3> selected="selected" </#if> value="3"  >已顶置
                                        </option>
											</select>
											</span>
											</td>
											</tr>


											<td class="filter_btn" colspan="6" align="center">
												<input class="btn btn-success radius" type="button" value="查询" onclick="submit()"/>

											</td>
										</tr>
      </table>
     </form>
    </div>

    <div class="cl pd-5 bg-1 bk-gray mt-20"> 

    <span class="r">共有数据：<strong>${pagination.totalCount}</strong> 条</span> </div>
    <table class="table table-border table-bordered table-bg">
        <thead>
        <tr  class="text-c">
            <th >会员卡号</th>
            <th >咨询时间</th>
            <th >咨询类型</th>
            <th >商品编号</th>
            <th >咨询内容</th>
            <th >回复时间</th>
            <th >回复状态</th>
            <th >审核状态</th>
            <th >显示状态</th>
            <th >顶置状态</th>
            <th >操作</th>
        </tr>
        </thead>
        <tbody >
         <#list pagination.list as list> 
         <tr  class="text-c">
            <td>${list.memberNo}</td>
            <td>${(list.askDate?string("yyyy-MM-dd HH:mm:ss"))!}</td>
            <td>${list.classifiedConsultation.name}</td>
            <td>${list.product.id}</td>
            <td width="300" style="word-break:break-all;text-align: left;">${list.question}</td>
            <td>${(list.answerDate?string("yyyy-MM-dd HH:mm:ss"))!}</td>
            <td>
 			<#if list.answerStatus==2>
				已回复&nbsp;
			</#if>
			<#if list.answerStatus==1>
				未回复&nbsp;
			</#if>
			<#if list.answerStatus==3>
				无需回复，已处理
			</#if>
			</td>
            <td>
 			<#if list.examineStatus==2>
				审核通过
			</#if>
			<#if list.examineStatus==1>
				未审核&nbsp;
			</#if>
			<#if list.examineStatus==3>
				审核驳回
			</#if>
			</td>
            <td>
            <#if list.showStatus==2>已隐藏
            <#else>已显示
            </#if></td>
            </td>
            <td>
            <#if list.isTop==1>已置顶
            <#else>未置顶
            </#if></td>
            <td>
 			<#if list.answerStatus==1&&list.examineStatus==1>
			<a href="javaScript:void(0)" onclick="reply('${list.id}')">回复</a><br />
			<a href="javaScript:void(0)" onclick="look('${list.id}')">查看</a>
			</#if>
			<#if list.answerStatus==2&&list.examineStatus==1>
			<a href="javaScript:void(0)" onclick="reply('${list.id}')">回复</a><br />
			<a href="javaScript:void(0)" onclick="examine('${list.id}')">审核</a><br />
			<a href="javaScript:void(0)" onclick="look('${list.id}')">查看</a>
			</#if>
			<#if list.answerStatus==2&&list.examineStatus==2>
			<a href="javaScript:void(0)" onclick="reply('${list.id}')">回复</a><br />
			<a href="javaScript:void(0)" onclick="examine('${list.id}')">审核</a><br />
			<a href="javaScript:void(0)" onclick="look('${list.id}')">查看</a><br />
			
			<#if list.showStatus==2>
				<a href="${contextPath}/productQuestions/show?QuestionId=${list.id}&page=${pagination.pageNo}">显示</a><br />
			</#if>
			<#if list.showStatus==1>
				<a href="${contextPath}/productQuestions/show?QuestionId=${list.id}&page=${pagination.pageNo}">隐藏</a><br />
			</#if>
			<#if list.isTop==0>
				<a href="${contextPath}/productQuestions/isTop?QuestionId=${list.id}&page=${pagination.pageNo}">置顶</a><br />
			</#if>
			<#if list.isTop==1>
				<a href="${contextPath}/productQuestions/isTop?QuestionId=${list.id}&page=${pagination.pageNo}">取消置顶</a><br />
			</#if>
			</#if>
			<#if list.answerStatus==2&&list.examineStatus==3>
			<a href="javaScript:void(0)" onclick="reply('${list.id}')">回复</a><br />
			<a href="javaScript:void(0)" onclick="look('${list.id}')">查看</a>
			</#if>
			<#if list.answerStatus==3&&list.examineStatus==1>
			<a href="javaScript:void(0)" onclick="reply('${list.id}')">回复</a><br />
			<a href="javaScript:void(0)" onclick="look('${list.id}')">查看</a>
			</#if>
            </td>
         </tr>
         </#list>
        </tbody>
    </table>
    <div id="div_page" style="padding-top: 10px;float: right"></div>
</div>
</div>
<@frame.end "default">
</@frame.end>
</html>
<script type="text/javascript" src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/laypage/laypage.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/new_arrival_product/query_list.js"></script>
<script type="text/javascript">
var path="${contextPath}";
laypage({
    cont: 'div_page',//容器。值支持id名、原生dom对象，jquery对象。
    pages: ${pagination.totalPage},//通过后台拿到的总页数
    curr:  ${pagination.pageNo} || 1, //当前页
	skip: true, //是否开启跳页
	first: 1, //将首页显示为数字1,。若不显示，设置false即可
	last: ${pagination.totalPage}, //将尾页显示为总页数。若不显示，设置false即可
    jump: function(obj , first){//触发分页后的回调
        if(!first){ //点击跳页触发函数;当前页为obj.curr
            $("#page").val(obj.curr);
            $("#search_form").submit();
        }
    }
});

$(function() {
	// 刷新页面后，对咨询类型一二级目录进行赋值
	var changeTypes = $("#changeTypesHidden").val();
	if(changeTypes != "") {
		$("#changeTypes").val(changeTypes);
		var classifiedConsultationId = $("#classifiedConsultationIdHidden").val();
		changeType(classifiedConsultationId);
	}
});
//回复咨询
function reply(id){

    var index = layer.open({
        type: 2,
        title: '回复',
        scrollbar: false,
        content: path+"/productQuestions/to_replyQuestions?QuestionId="+id,
        area: ['600px', '500px']
    });

	
}

//审核
function examine(id){
    var index = layer.open({
        type: 2,
        title: '审核',
        scrollbar: false,
        content: path+"/productQuestions/to_examine?QuestionId="+id,
        area: ['600px', '500px']
    });

	
}
//查看
function look(id){
    var index = layer.open({
        type: 2,
        title: '查看',
        scrollbar: false,
        content: path+"/productQuestions/look?QuestionId="+id,
        area: ['550px', '500px']
    });

	
}
//咨询类型
function changeType(v){
	
	var id=$("#changeTypes").val();
	if(id != "") {
		$.ajax({
			url : path + "/productQuestions/changeType",
			cache : false,
			type : 'post',
			dataType : 'html',
			data :{"changeType":id},
	        error : function() {
	        },
			success : function(data) {
			    $("#classifiedConsultationId").html(data);
			    if(v != null && v != "") {
			    	$("#classifiedConsultationId").val(v);
			    }
			}
		});
	} else {
		$("#classifiedConsultationId").html("<option  value=\"\">全部</option>");
	}
}
</script>